<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			
			var age = 18;
			
			//数组
			//Java
			// int ages = new int[15] {   100,200,300 , 3.14 xxx} ;
			
			//js中数组的定义
			// var ages = new Array();
			// var ages = [];
			
			var ages = [20,21,22,18,'abc', {name:'jshand'}];
			console.log("数组的长度: ages.length: "+ages.length);
			
			//想要访问数组中的元素
			// ages[0] //20
			console.log("ages[0]:  "+ages[0])
			// console.log("ages[1]:  "+ages[1])
			// console.log("ages[2]:  "+ages[2])
			// console.log("ages[3]:  "+ages[3])
			// console.log("ages[4]:  "+ages[4])
			// console.log("ages[5]:  "+ages[5])
			
			
			ages[7] = 700;
			
			//遍历元素
			for(var i=0;i<ages.length;i++){
				console.log("ages["+i+"] : "+ages[i])
			}
			
			
			//数组的长度是不固定的，没有赋值的下标内容为undefined
			
			
			
			
			
			
			
			
			
			
			
			
			
		</script>
	</head>
	<body>
	</body>
</html>
